import '../index.dart';

/*欢迎页*/
class WelcomePage extends StatefulWidget {
  const WelcomePage({Key? key}) : super(key: key);

  @override
  _WelcomeState createState() => _WelcomeState();
}

class _WelcomeState extends State<WelcomePage> {
  @override
  void initState() {
    super.initState();

    //初始化状态
    Future.delayed(const Duration(seconds: 3), () {
      // if (Provider.of<UserModel>(context).isLogin) {
      if (Global.profile.user != null) {
        if (Global.profile.isInitData == true) {
          Navigator.pushReplacementNamed(context, "start");
        } else {
          Navigator.pushReplacementNamed(context, "init_data");
        }
      } else {
        Navigator.pushReplacementNamed(context, "login");
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      body: Column(
        // mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Expanded(
              child: Center(
            child: Text(
              S.of(context).title,
              style: Theme.of(context)
                  .textTheme
                  .displayLarge
                  ?.copyWith(color: Theme.of(context).colorScheme.primary),
            ),
          )),
          Padding(
            child: Text(
              '欢迎回来',
            ),
            padding: EdgeInsets.all(50),
          )
        ],
      ),
    );
  }
}
